<nav class="navbar navbar-default" role="navigation">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a id="logo" class="hidden-lg" href="<?php echo base_url() ?>"><img style="width: 80%; height: 7%; padding: 5px;" src="<?php echo base_url() ?>assets/images/logo_home.png"></a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li><a style="color: #F36F00; font-weight: bold; font-size: 18px;" href="<?php echo base_url() ?>"> Trang chủ </a></li>
                <li id="registerMenu"><a style="color: #F36F00; font-weight: bold; font-size: 18px;" href="<?php echo base_url() ?>register"> Đăng ký </a></li>
                <li id="loginMenu"><a style="color: #F36F00; font-weight: bold; font-size: 18px;" href="<?php echo base_url() ?>login"> Đăng nhập </a></li>
                <li id="logoutMenu" style="display: none"><a style="color: #F36F00; font-weight: bold; font-size: 18px;" href="<?php echo base_url() ?>logout"> Đăng xuất </a></li>
                <li><a style="color: #F36F00; font-weight: bold; font-size: 18px; cursor: pointer" onclick="window.location.href = '<?php echo base_url() ?>cart'"> Giỏ hàng (<span id="spnShoppingCart"><?php if($this->session->userdata('numOfProductsCart') == ''){echo 0;} else{echo $this->session->userdata('numOfProductsCart');} ?></span>) </a></li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>

<script>
    $(document).ready( function() {
        $('.dropdown-toggle').dropdown();
        displayMenu();
    });

    function displayMenu(){
        var email = "<?php echo $this->session->userdata('email'); ?>";
//        alert(email);
        if(email != ''){
            $('#registerMenu').hide();
            $('#loginMenu').hide();
            $('#logoutMenu').show();
        }
    }
</script>
